package com.fbs.wowo.util.eos;

import com.fbs.wowo.exception.CreateEntityFailedException;
import com.routz.eos.rpctool.domain.ChainInfo;

import java.util.Map;

public interface EOSService {
    /**
     * 生成公钥 私钥
     * @return Map
     */
    Map<String, String> EOSKey();

    /**
     * 创建新账户
     * @param newAccountName    用户账户名
     * @param publicKey         用户公钥
     * @param privateKey        用户私钥
     * @return  transactionId
     * @throws CreateEntityFailedException 创建失败
     */
    String newaccount(String newAccountName, String publicKey, String privateKey) throws CreateEntityFailedException;

    /**
     * getChainInfo
     * @return ChainInfo
     * @throws CreateEntityFailedException
     */
    ChainInfo getChainInfo() throws CreateEntityFailedException;

    /**
     * 图文存证
     * @param userId        存证用户id
     * @param privateKey    存证用户私钥
     * @param albumId       专辑id
     * @param title         标题
     * @param writer        作者
     * @param ownerId       拥有者id
     * @param fingerprint   数据指纹
     * @param ipfsUrl       ipfs 网址
     * @return 返回EosTransactionResponse 包含transactionId，
     * @throws CreateEntityFailedException 发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse imagetextEvidence(String userId, String privateKey, String albumId, String title, String writer, String ownerId, String fingerprint, String ipfsUrl) throws CreateEntityFailedException;

    /**
     * 音频存证
     * @param userId        存证用户id
     * @param privateKey    存证用户私钥
     * @param albumId       专辑id
     * @param title         标题
     * @param writer        作者
     * @param ownerId       拥有者id
     * @param fingerprint   数据指纹
     * @param ipfsUrl       ipfs 网址
     * @return 返回EosTransactionResponse 包含transactionId，
     * @throws CreateEntityFailedException 发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse audioEvidence(String userId, String privateKey, String albumId, String title, String writer, String ownerId, String fingerprint, String ipfsUrl) throws CreateEntityFailedException;

    /**
     * 直播存证
     * @param userId        存证用户id
     * @param privateKey    存证用户私钥
     * @param albumId       专辑id
     * @param title         标题
     * @param writer        作者
     * @param ownerId       拥有者id
     * @param fingerprint   数据指纹
     * @param ipfsUrl       ipfs 网址
     * @return 返回EosTransactionResponse 包含transactionId，
     * @throws CreateEntityFailedException 发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse liveEvidence(String userId, String privateKey, String albumId, String title, String writer, String ownerId, String fingerprint, String ipfsUrl) throws CreateEntityFailedException;

    /**
     * 图文确权
     * @param userId        存证用户id
     * @param privateKey    存证用户私钥
     * @param fingerprint   数据指纹
     * @return 返回EosTransactionResponse 包含交易Id，区块高度，chainId
     * @throws CreateEntityFailedException  发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse imagetextAuthright(String userId, String privateKey, String fingerprint) throws CreateEntityFailedException;

    /**
     * 音频确权
     * @param userId        存证用户id
     * @param privateKey    存证用户私钥
     * @param fingerprint   数据指纹
     * @return 返回EosTransactionResponse 包含交易Id，区块高度，chainId
     * @throws CreateEntityFailedException  发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse audioAuthright(String userId, String privateKey, String fingerprint) throws CreateEntityFailedException;

    /**
     * 直播确权
     * @param userId        存证用户id
     * @param privateKey    存证用户私钥
     * @param fingerprint   数据指纹
     * @return 返回EosTransactionResponse 包含交易Id，区块高度，chainId
     * @throws CreateEntityFailedException  发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse liveAuthright(String userId, String privateKey, String fingerprint) throws CreateEntityFailedException;

    /**
     * 执行交易
     * @param sellerId      卖家id
     * @param buyerId       买家id
     * @param privateKey    卖家私钥
     * @param fingerprint   数据指纹
     * @param type          交易作品类型：
     *                          audio: 语音
     *                          imagetext: 图文
     *                          live: 直播
     * @param quantity      交易费用 3.0000 RMB
     * @param memo          备注 transcpy花费3rmb购买imagetext用户的版权
     * @return 返回EosTransactionResponse 包含交易Id，区块高度，chainId
     * @throws CreateEntityFailedException 发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse transcpyTrans(String sellerId, String buyerId, String privateKey, String fingerprint, String type, String quantity, String memo) throws CreateEntityFailedException;

    /**
     * 删除
     * @param userId        要删除的作品的版权的拥有者id
     * @param privateKey    拥有者的私钥
     * @param fingerprint   数据指纹
     * @param type          交易作品类型：
     *                          audio: 语音
     *                          imagetext: 图文
     *                          live: 直播
     * @param memo          备注
     * @return  返回EosTransactionResponse 包含交易Id，区块高度，chainId
     * @throws CreateEntityFailedException 发送网络请求可能失败抛异常
     */
    EOSServiceImp.EosTransactionResponse transcpyDeleteitem(String userId, String privateKey, String fingerprint, String type, String memo) throws CreateEntityFailedException;


}
